home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / RCSC.ZIP / PACKAGES / CAS.ZIP / DAS.DOC < prev    next >
Text File  |  1996-10-24  |  7KB  |  161 lines

  1.                  8051 DISASSEMBLER, notes on use.
  2.  
  3. (0) COMMAND LINE, INPUT FORMAT
  4.    This is a disassembler for the Intel 8051-family of processors.  It is
  5. currently set to read up to and including the 8052.
  6.  
  7.    The typical conmmand line for this disassembler is:
  8.  
  9.                      das <asm.hex >asm.s
  10.  
  11. The input file (read from standard input) is assumed to be in Intel Hex
  12. Format.  The output is placed in standard output (or in a file when
  13. redirection is used).  A third file:
  14.  
  15.                           entries
  16.  
  17. is used to specify a list of entry points for das to use.
  18.  
  19.    Currently, it will only accept input in Intel Hex format located between
  20. the addresses 0000 and 4000 (hex).  It will read entry points from a file:
  21. "entries" and recursively disassemble all the addresses "reachible" from
  22. those listed as entry points.  A sample entries file, input file and output file
  23. are provided with the software.  The format of each address in the file is
  24. (starting at column 1):
  25.  
  26. HHHH<cr>
  27.  
  28. with the H's representing the digits of the address in hexadecimal.
  29.  
  30.    Typically entry points are assigned to 0000, the starting address, and
  31. the address of each interrupt-handler that is used.
  32.  
  33. (1) OUTPUT FORMAT
  34.    The output of the disassembler is not exactly re-assembleable.  When the
  35. disassembler searches for reachible segments of code, it will fail to resolve
  36. indirect jumps (jmp @A + DPTR, jmp @A + PC), and will fail to recognize
  37. virtual jumps created by manipulating the stack pointer, e.g.
  38.  
  39. push DPL
  40. push DPH
  41. ret        ;;; An indirect jump to the address pointed to by DPTR.
  42.  
  43. In addition, if the original program contained data tables, these would
  44. normally be passed by untouched.
  45.  
  46.    The disassembler will regard anything in the allocated code space that
  47. was not accessible as being data.  If necessary, you will have to visually
  48. inspect the disassembled code for indirect jumps and stack pointer
  49. manipulations to determine what addresses are being indirectly referenced.
  50. Then you could add these addresses to the entry point list in the file
  51. "entries" and disassemble again.  This, in turn, may reveal additional
  52. indirect addresses, so that there is an iterative process implied here to
  53. completely disassemble code.
  54.  
  55.    For assistance, a list of locations where indirect jumps occur will be
  56. listed in the following format:
  57.  
  58. Indirect jump at <Address>
  59.  
  60.    In the sample program provided, there were no indirect jumps.  However,
  61. since the assembly-language software implements a multitasking kernel, it
  62. heavily manipulates the stack pointer.  Consquently, the addresses listed in
  63. the entries file are not just the starting address (0000), and interrupt
  64. handler(s) (0023), but also derived addresses: 0067 (found on the first
  65. iteration). and 0131 (found on the second).
  66.  
  67.    Also, any addresses referenced that lie outside the range of the Intel Hex
  68. Format file will be listed as external references.  These are listed in the
  69. following form:
  70.  
  71. REF: <Address>
  72.  
  73.    Data segments will be clearly marked as such, beginning with the header:
  74.  
  75. DATA at <Address>
  76.  
  77. following which will be a hexadecimal listing of the "data" in the format
  78. illustrated below:
  79.  
  80. 34 aa ef 00 00 00 00 00 34 ee ff 00 00 00 00 00 |4       4      |
  81.  
  82. A list of up to 16 bytes in hexadecimal notation is generated, and then between
  83. vertical bars is the list of corresponding ASCII characters. Control characters
  84. and meta characters (those ranging from 128 to 255) are "blanked" out.  The
  85. character listing allows you to easily recognize embedded string constants
  86. wherever they occur.
  87.  
  88. Labels are generated for SFR's corresponding to the 8052 processor, and Bit
  89. labels are likewise generated.  These are listed in the tables SFRs, and Bits
  90. contained in the disassembler source, and can be modified to suit whatever
  91. version of the 8051 you are using.
  92.  
  93. In the output, addresses are labeled in the format illustrated below:
  94.  
  95.                              C3458
  96.  
  97. The initial letter indicates the number of times this address is referenced
  98. with the following key:
  99.  
  100.              B = 1 reference, C = 2 references, D = 3, E = 4, etc.
  101.  
  102. the next 4 items represent that actual address of the label in hexadecimal.
  103.  
  104. (2) ERRORS
  105.    The disassembler will duly note where disassembled instructions overlap,
  106. or where it cannot further process input.
  107.  
  108. No entry points listed.
  109. Bad hexadecimal digit in input.
  110.    The input file "entries" was not found, or contained corrupt data.
  111.  
  112. Address out of range 0 - 4000h in input.
  113.    The input file contains a portion of a program lying outside the address
  114.    range 0 to 4000 (hex).  The disassembler cannot go beyond 4000h.  This is
  115.    a fatal error, disassembly stops.
  116.  
  117. Bad format string, PC = HHHH.
  118.    Something's wrong with your compiler or operating system, or the source file
  119.    has been corrupted.  Report this promptly to me, if you should see this. :)
  120.  
  121. Bad hexadecimal digit in input.
  122. Bad checksum.
  123. Unexpected EOF
  124.    The input file contained a portion not strictly in Intel Hex Format.
  125.  
  126. Entry into ARG at <Address>.
  127.    An entry point is accessing a point that has already been disassembled as
  128.    the interior of an instruction.
  129.  
  130. OP into ARG at <Address>.
  131.    An attempt was made to disassemble an instruction starting at an address
  132.    already contained in the interior of another instriction.  The disassembler
  133.    is generating overlapping instructions.
  134.  
  135. ARG into OP at <Address>.
  136.    An attempt was made to disassemble an argument to an instruction at an
  137.    address already disassembled as the first byte of another instruction.
  138.  
  139. ARG into ARG at <Address>.
  140.    An attempt was made to disassemble an argument to an instruction at an
  141.    address already disassembled as an argument of another instruction.
  142.  
  143.    The presence of this error indicates that something is wrong with your
  144.    compiler or operating system, or the source file has been corrupted.
  145.    Report this promptly to me, as well, if you should see this error.
  146.  
  147. Too many entries, PC = <Address>.
  148.    The number of pending points for the disassembler to process exceeded its
  149.    capacity.
  150.  
  151. (3) USER SUPPORT and GUARANTEE
  152.    This software has been rigorously verified with respect to the description
  153. given above.  It will also conform to the description of the binary coding
  154. of the 8051 processor supplied by Intel.
  155.    Since this was a hobby project mainly intended for myself and not for a
  156. wider audience, you will be on your own in using this software.  However, I am
  157. interested in hearing any feedback you have.  Send comments to my e-mail
  158. address, markh@csd4.csd.uwm.edu.  If you want to make upgrades, I encourage
  159. you to try your hand at it.  That's exactly why I'm distributing this package
  160. free.
  161.